// import { LoadJS } from "../core/helper/loadJS";

class TyyOOS {
    client?: any
    constructor() {
        this.init()
    }

    async init() {
        // await LoadJS.load('/plugins/tyy/oos-sdk-6.0.min.js', () => {
        //     // @ts-ignore
        //     return OOS
        // })
        // // @ts-ignore
        // this.client = new OOS.S3({
        //     accessKeyId: 'accessKeyId',
        //     secretAccessKey: 'secretAccessKey',
        //     endpoint: 'endPoint',
        //     signatureVersion: 'v2',
        //     apiVersion: '2006-03-01',
        //     s3ForcePathStyle: true
        // })
    }

    /** 上传文件
     * @param params 用户 bucket 名称
     * @returns 
     */
    putObject(params: {
        Body: File, Bucket: 'BucketName', Key: 'key'
    }) {
        if (!this.client) return
        this.client.putObject(params, function (err, _data) {
            if (err) {
                console.log(err, err.stack); // an error occurred
            }
            else {
                // console.log(data, endPoint + '/' + params.Bucket + '/' + params.Key);           // successful response
                // that.imageUrlList.push({ name: params.Key, url: 'https://' + endPoint + '/' + params.Bucket + '/' + params.Key });
                // that.emitInput(that.imageUrlList);
            }
        });
    }

}

export const tyyOOS = new TyyOOS()